package com.company.apollo_query.apollo_query.apollo_query.tb_shipping_order_main.generated;

import com.company.apollo_query.apollo_query.apollo_query.tb_shipping_order_main.TbShippingOrderMain;
import com.company.apollo_query.apollo_query.apollo_query.tb_shipping_order_main.TbShippingOrderMainImpl;
import com.speedment.common.injector.annotation.ExecuteBefore;
import com.speedment.runtime.config.identifier.TableIdentifier;
import com.speedment.runtime.core.component.sql.SqlPersistenceComponent;
import com.speedment.runtime.core.component.sql.SqlStreamSupplierComponent;
import com.speedment.runtime.core.exception.SpeedmentException;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.annotation.Generated;
import static com.speedment.common.injector.State.RESOLVED;

/**
 * The generated Sql Adapter for a {@link
 * com.company.apollo_query.apollo_query.apollo_query.tb_shipping_order_main.TbShippingOrderMain}
 * entity.
 * <p>
 * This file has been automatically generated by Speedment. Any changes made to
 * it will be overwritten.
 * 
 * @author Speedment
 */
@Generated("Speedment")
public abstract class GeneratedTbShippingOrderMainSqlAdapter {
    
    private final TableIdentifier<TbShippingOrderMain> tableIdentifier;
    
    protected GeneratedTbShippingOrderMainSqlAdapter() {
        this.tableIdentifier = TableIdentifier.of("apollo_query", "apollo_query", "tb_shipping_order_main");
    }
    
    @ExecuteBefore(RESOLVED)
    void installMethodName(SqlStreamSupplierComponent streamSupplierComponent, SqlPersistenceComponent persistenceComponent) {
        streamSupplierComponent.install(tableIdentifier, this::apply);
        persistenceComponent.install(tableIdentifier);
    }
    
    protected TbShippingOrderMain apply(ResultSet resultSet) throws SpeedmentException{
        final TbShippingOrderMain entity = createEntity();
        try {
            entity.setId(resultSet.getLong(1));
            entity.setTrackingId(resultSet.getLong(2));
            entity.setSourceId(resultSet.getInt(3));
            entity.setPlatformTrackingId(resultSet.getString(4));
            entity.setRetailerId(resultSet.getLong(5));
            entity.setShippingOption(resultSet.getByte(6));
            entity.setGridId(resultSet.getLong(7));
            entity.setCarrierId(resultSet.getInt(8));
            entity.setAgentId(resultSet.getInt(9));
            entity.setStationId(resultSet.getInt(10));
            entity.setCarrierDriverId(resultSet.getString(11));
            entity.setShippingState(resultSet.getByte(12));
            entity.setShippingReasonCode(resultSet.getByte(13));
            entity.setRemarkCode(resultSet.getString(14));
            entity.setCityid(resultSet.getInt(15));
            entity.setAcceptAt(resultSet.getTimestamp(16));
            entity.setCompleteAt(resultSet.getTimestamp(17));
            entity.setUpdatedAt(resultSet.getTimestamp(18));
            entity.setCreatedAt(resultSet.getTimestamp(19));
        } catch (final SQLException sqle) {
            throw new SpeedmentException(sqle);
        }
        return entity;
    }
    
    protected TbShippingOrderMainImpl createEntity() {
        return new TbShippingOrderMainImpl();
    }
}